// 组织架构模块
import {request} from '@/utils/request';
import type { DeptsData, AddDepts, DeptManager, Depts } from '@/types/departments';


// 获取组织部门列表
export const getDeptsApi = () => {
  return request<DeptsData>('/company/department')
}

// 删除部门
export const delDeptsApi = (id: string) => {
  return request(`/company/department/${id}`, 'DELETE')
}

// 新增部门
export const addDeptsApi = (data: AddDepts) => {
  return request('/company/department', 'POST', data)
}

// 获取部门负责人列表
export const getDeptsListApi = () => {
  return request<DeptManager[]>('/sys/user/simple')
}

// 获取部门详情
export const getDeptsDetailApi = (id: string) => {
  return request<Depts>(`/company/department/${id}`)
}

// 更新部门
export const updateDeptsApi = (data: Depts) => {
  return request(`/company/department/${data.id}`, 'PUT', data)
}